package com.eastmoney.emis.edda.domain.valueobject;

/**
 * HSBC/non-HSBC accounts	            Status Code	    Status Description
 * Status for debtor accounts with HSBC	    ACSC	      Accepted Settlement Completed (Processed by Bank)
 * Status for debtor accounts with HSBC	    RJCT	      Rejected by Bank
 * Status for debtor accounts with HSBC	    ACCP	      AcceptedCustomerProfile - Preceding check of technical validation was successful. Customer profile check was also successful.
 * Status for debtor accounts with non-HSBC	ACSP          AcceptedSettlementInProcess - Pending to FPS
 *
 * @projectName: EDDA-HSBC
 * @package: com.eastmoney.emis.edda.domain
 * @author: 汪程程
 * @date: 2022/9/27 2:13 PM
 * @version: 1.0
 */
public enum PaymentStatus {

    ACSC,
    RJCT,
    ACCP,
    ACSP,
    UNKNOWN;

    public static PaymentStatus parse(String status) {
        for (PaymentStatus paymentStatus : PaymentStatus.values()) {
            if (paymentStatus.name().equals(status)) {
                return paymentStatus;
            }
        }
        return UNKNOWN;
    }

    public EddiStatus transferToEddiStatus() {
        switch (this) {
            case ACSC:
                return EddiStatus.BANK_PROCESS_SUCCESS;
            case RJCT:
                return EddiStatus.BANK_PROCESS_FAIL;
        }
        return EddiStatus.BANK_PROCESS;
    }
}
